import java.io.*;
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;
public class Myhead {
    //Main函数，程序入口
    public static void main(String[] args) {
        //调用读取方法，定义文件以及读取行数
        Scanner num =new Scanner(System.in);
        int m=num.nextInt();
        readLine(new File("C:\\test\\20165211.txt"), m);
    }

    public static List<String> readLine(File file, long numRead) {

        List<String> result = new ArrayList<String>();

        long count = 0;

        if (!file.exists() || file.isDirectory() || !file.canRead()) {
            return null;
        }

        RandomAccessFile fileRead = null;
        try {

            fileRead = new RandomAccessFile(file, "r");

            long length = fileRead.length();

            if (length == 0L) {
                return result;
            } else {

                long pos = 0;
                while (count < numRead) {

                    fileRead.seek(pos);

                    if (fileRead.readByte() == '\n') {
                        String line = fileRead.readLine();
                        result.add(line);

                        System.out.println(line);

                        count++;

                    }
                    pos++;
                }
            }
        } catch (IOException e) {
            e.printStackTrace();
        } finally {
            if (fileRead != null) {
                try {
                    fileRead.close();
                } catch (Exception e) {
                }
            }
        }
        return result;
    }
}